﻿@{
    ViewBag.Title = "Page Listing";
}
@using PagedList.Mvc;
@using PagedList; 
@{
    Layout = "~/Views/Shared/Admin.cshtml";
}
<!-- import the included stylesheet for some (very basic) default styling -->
<link href="@Url.Content("~/Content/PagedList.css")" rel="stylesheet" type="text/css" />


<h2>List of Pages</h2>
<p>@TempData["Message"] </p>
@Html.ActionLink(
    "Create", 
    "EditPage")   
<br />
<Table>
    @foreach(var page in ViewBag.OnePageOfPages){
        <tr><td>@Html.ActionLink("Edit", "EditPage", new { Id = page.Id })</td>

    <td>@Html.ActionLink(
    "Delete", 
    "Delete", 
    new { id = page.Id }, 
    new { onclick = "return confirm('Are you sure you wish to delete this page?');" }) </td>

       <td><a href="/Content/@page.PageName" target="_blank">View</a></td>
        <td>@page.PageName</td>
         <td>@page.PageTitle</td>
        </tr>
    }
</Table>


@Html.PagedListPager( (IPagedList)ViewBag.OnePageOfPages, page => Url.Action("List", new { page }) )